home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_weap_imp5.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  213 lines

  1. # Jones 3D Cog Script
  2. #
  3. # weap_IMP5.cog
  4. #
  5. # [RT]
  6. #
  7. # Controls Infernal Machine Part #5, the Reality Dialator.
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        startup
  16. message        fire
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21. message        callback
  22. message        timer
  23. message        pulse
  24. message        changed
  25.  
  26. model        impOn=imp5_dial_on.3do        local    # Autoloaded
  27. model        impOff=imp5_dial.3do        local    # Autoloaded
  28.  
  29. sound        pull=gen_grenade_pull.wav    local    # Autoloaded
  30. sound        put=gen_grenade_put.wav        local    # Autoloaded
  31. sound        pow=imp5_chargeup.wav        local    # Autoloaded
  32. sound        on=imp5_powerup.wav            local    # Autoloaded
  33. sound        off=imp5_powerdown.wav        local    # Autoloaded
  34. sound        loop=imp5_on_loop.wav        local    # Autoloaded
  35.  
  36. template    projectile=+imp5            local    # Autoloaded
  37. template    tplGlow=+imp5_glow            local    # Autoloaded
  38.  
  39. thing        player                        local
  40. thing        glow                        local
  41.  
  42. int            weaponNum=18                local
  43. int            handMesh                    local
  44. int            handNode                    local
  45. int            callNum                        local
  46. int            curSound                    local
  47. #int            index                        local
  48.  
  49. int            bDisabled=0                    local
  50. int            bFiring=0                    local
  51.  
  52. vector        firePos                        local
  53. vector        dustPos                        local
  54.  
  55. end
  56.  
  57. # ===================================================================
  58.  
  59. code
  60.  
  61. startup:
  62.  
  63.     player = GetLocalPlayerThing();
  64.     handMesh = GetMeshByName(player, "inrhand");
  65.     handNode = GetNodeByName(player, "inrhand");
  66.  
  67.     return;
  68.  
  69. # -------------------------------------------------------------------
  70.  
  71. fire:
  72.  
  73.     if (bDisabled)
  74.     {
  75.         bDisabled = 0;
  76.         return;
  77.     }
  78.  
  79.     SetThingMesh(player, handMesh, impOn, 0);
  80.  
  81.     firePos = GetThingJointPos(player, handNode);
  82.     FireProjectile(player, projectile, pow, -1, firePos, '0 0 0', 1.0, 0x0, 0.0, 0.0);
  83.  
  84.     dustPos = GetThingJointPos(player, handNode);
  85.     dustPos = VectorAdd(dustPos, '0 0 0.025'); 
  86.     MakeFairyDust(player, dustPos);
  87.  
  88.     IMPStartFiring(18);
  89.     bFiring = 1;
  90.  
  91.     SetFireWait(player, 3.5);
  92.     SetTimer(3.0);
  93.     SetPulse(0.1);
  94.  
  95.     return;
  96.  
  97. # -------------------------------------------------------------------
  98.  
  99. activated:
  100.  
  101.     ActivateWeapon(player, 0.01);
  102.     return;
  103.  
  104. # -------------------------------------------------------------------
  105.  
  106. deactivated:
  107.  
  108.     DeactivateWeapon(player);
  109.     return;
  110.  
  111. # -------------------------------------------------------------------
  112.  
  113. selected:
  114.  
  115.     SetAimWait(player, 0.0);
  116.     SetMountWait(player, 0.7);
  117.  
  118.     SetArmedMode(player, 5);
  119.     SetCurWeapon(player, weaponNum);
  120.     SetThingFireOffset(player, '0.0 0.0 0.0'); 
  121.  
  122.     CaptureThing(player);
  123.     PlayMode(player, 66, 0);
  124.  
  125.     return;
  126.  
  127. # -------------------------------------------------------------------
  128.  
  129. deselected:
  130.  
  131.     SetMountWait(player, 1.0);
  132.     StopMode(player, 66, 0);
  133.  
  134.     CaptureThing(player);
  135.     PlayMode(player, 67, 0);
  136.  
  137.     SetArmedMode(player, 0);
  138.  
  139.     StopSound(curSound, 0.0);
  140.     PlaySoundThing(off, player, 1, -1, -1, 0x880);
  141.  
  142.     return;
  143.  
  144. # -------------------------------------------------------------------
  145.  
  146. callback:
  147.  
  148.     callNum = GetParam(1);
  149.     ReleaseThing(player);
  150.  
  151.     if (callNum == 28)
  152.     {
  153.         # Model swaps & FX
  154.         SetWeaponModel(player, weaponNum);
  155.         glow = AttachThingToThingMesh(player, tplGlow, handMesh);
  156.         
  157.         # Sounds
  158.         PlaySoundThing(pull, player, 1, -1, -1, 0x880);
  159.         PlaySoundThing(on, player, 1, -1, -1, 0x880);
  160.         Sleep(0.25);
  161.         curSound = PlaySoundThing(loop, player, 1, -1, -1, 0x881);
  162.     }
  163.     else if (callNum == 29)
  164.     {
  165.         if (bFiring)
  166.         {
  167.             IMPEndFiring(18);
  168.             SetPulse(0);
  169.             bFiring = 0;
  170.         }
  171.  
  172.         # Cleanup...
  173.         ResetWeaponModel(player);
  174.         DetachThingMesh(glow);
  175.  
  176.         PlaySoundThing(put, player, 1, -1, -1, 0x880);
  177.     }
  178.  
  179.     return;
  180.  
  181. # -------------------------------------------------------------------
  182.  
  183. timer:
  184.  
  185.     if (bFiring)
  186.     {
  187.         SetThingMesh(player, handMesh, impOff, 0);
  188.         IMPEndFiring(18);
  189.         SetPulse(0);
  190.     }
  191.  
  192.     bFiring = 0;
  193.     return;
  194.  
  195. # -------------------------------------------------------------------
  196.  
  197. pulse:
  198.  
  199.     dustPos = GetThingJointPos(player, handNode);
  200.     dustPos = VectorAdd(dustPos, '0 0 0.025'); 
  201.     MakeFairyDust(player, dustPos);
  202.     return;
  203.  
  204. # -------------------------------------------------------------------
  205.  
  206. changed:
  207.  
  208.     # This message is called when an IMP is activated on an IMP stand
  209.     bDisabled = 1;
  210.     return;
  211.  
  212. end
  213.